home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / mx / remoting / Service.as < prev   
Text File  |  2007-11-08  |  2KB  |  82 lines

  1. class mx.remoting.Service extends Object
  2. {
  3.    static var version = "1.2.0.124";
  4.    var _allowRes = false;
  5.    function Service(gatewayURI, logger, serviceName, conn, resp)
  6.    {
  7.       super();
  8.       this.log = logger;
  9.       this.log.logInfo("Creating Service for " + serviceName,mx.services.Log.VERBOSE);
  10.       if(gatewayURI == "" && conn == null)
  11.       {
  12.          gatewayURI = mx.remoting.NetServices.gatewayUrl;
  13.       }
  14.       gatewayURI = mx.remoting.NetServices.getHttpUrl(gatewayURI);
  15.       if(conn == null)
  16.       {
  17.          conn = mx.remoting.NetServices.getConnection(gatewayURI);
  18.          if(conn == null)
  19.          {
  20.             this.log.logInfo("Creating gateway connection for " + gatewayURI,mx.services.Log.VERBOSE);
  21.             conn = mx.remoting.NetServices.createGatewayConnection(gatewayURI,logger);
  22.          }
  23.       }
  24.       this.__conn = conn;
  25.       conn.updateConfig();
  26.       this._allowRes = true;
  27.       this.__serviceName = serviceName;
  28.       this.__responder = resp;
  29.       this.log.logInfo("Successfully created Service",mx.services.Log.VERBOSE);
  30.    }
  31.    function get connection()
  32.    {
  33.       return this.__conn;
  34.    }
  35.    function __resolve(methodName)
  36.    {
  37.       if(this._allowRes)
  38.       {
  39.          var _loc2_ = this.__makeOpFunc(methodName);
  40.          this[methodName] = _loc2_;
  41.          return _loc2_;
  42.       }
  43.       return null;
  44.    }
  45.    function __makeOpFunc(name)
  46.    {
  47.       var op = new mx.remoting.Operation(name,this);
  48.       var _loc3_ = function()
  49.       {
  50.          op.invoke(arguments);
  51.          return op.send();
  52.       };
  53.       _loc3_.send = function()
  54.       {
  55.          return op.createThenSend();
  56.       };
  57.       _loc3_.setResponder = function(resp)
  58.       {
  59.          op.responder = resp;
  60.       };
  61.       _loc3_.getRequest = function()
  62.       {
  63.          return op.request;
  64.       };
  65.       _loc3_.setRequest = function(val)
  66.       {
  67.          op.request = val;
  68.       };
  69.       _loc3_.addProperty("request",_loc3_.getRequest,_loc3_.setRequest);
  70.       _loc3_.operation = op;
  71.       return _loc3_;
  72.    }
  73.    function get name()
  74.    {
  75.       return this.__serviceName;
  76.    }
  77.    function get responder()
  78.    {
  79.       return this.__responder;
  80.    }
  81. }
  82.